package org.example.DesignPatterns.Builder;

import java.util.ArrayList;
import java.util.List;

/**
 * @description:
 * @author: farprt
 * @create: 2022-09-18 12:10
 **/
public class Building {

    private List<String> buildingComponents=new ArrayList<>();

    public void setBasement(String basement){
        buildingComponents.add(basement);
    }

    public void setWall(String wall){
        buildingComponents.add(wall);
    }

    public void setRoof(String roof){
        buildingComponents.add(roof);
    }

    @Override
    public String toString() {
        StringBuilder sb=new StringBuilder();

        for(int i=buildingComponents.size()-1;i>=0;i--){
            sb.append(buildingComponents.get(i));
        }
        return sb.toString();
    }
}